package com.jqkb.service.bean;

import com.fasterxml.jackson.annotation.JsonIgnore;

import java.io.Serializable;

public class User implements Serializable {
    private Long id;
    private String name;
    private String loginKey = "";
    private Unit unit;

    public Unit getUnit() {
        return unit;
    }

    public void setUnit(Unit unit) {
        this.unit = unit;
    }

    private String jingHao;
    private int grade;
    private String mobile;
    private int order;
    private boolean checked;
    private String[] allPermissions;

    public String[] getAllPermissions() {
        return allPermissions;
    }


    public boolean hasPermission(String permission) {

        String[] allPermissions = getAllPermissions();
        if (allPermissions == null) {
            return false;
        } else {
            for (int i = 0; i < allPermissions.length; i++) {

                if (allPermissions[i].equals(permission)) {

                    return true;
                }


            }

        }
        return false;

    }

    public void setAllPermissions(String[] allPermissions) {
        this.allPermissions = allPermissions;
    }

    public String getJingHao() {
        return jingHao;
    }

    public void setJingHao(String jingHao) {
        this.jingHao = jingHao;
    }

    public int getGrade() {
        return grade;
    }

    public void setGrade(int grade) {
        this.grade = grade;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public int getOrder() {
        return order;
    }

    public void setOrder(int order) {
        this.order = order;
    }

    public String getLoginKey() {
        return loginKey;
    }

    public void setLoginKey(String loginKey) {
        this.loginKey = loginKey;
    }


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    @JsonIgnore
    public boolean isChecked() {
        return checked;
    }

    public void setChecked(boolean checked) {
        this.checked = checked;
    }
}
